﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace RssReader.Core.BL
{
	public sealed class Validation
	{
		#region Private Properties
		private static Validation _instance;
		private static object _objLocker = new object();
		#endregion

		#region Public Properties
		public static Validation Instance
		{
			get
			{
				if (_instance == null)
				{
					lock (_objLocker)
					{
						if (_instance == null)
						{
							_instance = new Validation();
						}
					}
				}
				return _instance;
			}
		}
		#endregion

		#region Constructors
		private Validation()
		{
		}
		#endregion

		#region Private Methods

		#endregion

		#region Public Methods
		public bool IsEmpty(string value)
		{
			return String.IsNullOrEmpty(value);
		}

		public bool IsEmail(string value)
		{
			return Regex.IsMatch(value, "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
		}
		#endregion
	}
}
